package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GradeTableMapper;
import com.ruoyi.system.domain.GradeTable;
import com.ruoyi.system.service.IGradeTableService;

/**
 * 选手成绩录入Service业务层处理
 *
 * @author zhangjinlei
 * @date 2022-04-26
 */
@Service
public class GradeTableServiceImpl implements IGradeTableService
{
    @Autowired
    private GradeTableMapper gradeTableMapper;

    /**
     * 查询选手成绩录入
     *
     * @param id 选手成绩录入主键
     * @return 选手成绩录入
     */
    @Override
    public GradeTable selectGradeTableById(Long id)
    {
        return gradeTableMapper.selectGradeTableById(id);
    }

    /**
     * 查询选手成绩录入列表
     *
     * @param gradeTable 选手成绩录入
     * @return 选手成绩录入
     */
    @Override
    public List<GradeTable> selectGradeTableList(GradeTable gradeTable)
    {
        List<GradeTable> selectGradeTableList = gradeTableMapper.selectGradeTableList(gradeTable);
        return selectGradeTableList;
    }
    @Override
    public List<GradeTable> selectCpRankingList(GradeTable gradeTable)
    {
        return  gradeTableMapper.selectCpRankingList(gradeTable);
    }


    /**
     * 新增选手成绩录入
     *
     * @param gradeTable 选手成绩录入
     * @return 结果
     */
    @Override
    public int insertGradeTable(GradeTable gradeTable)
    {
        gradeTable.setCreateTime(DateUtils.getNowDate());
        return gradeTableMapper.insertGradeTable(gradeTable);
    }

    /**
     * 修改选手成绩录入
     *
     * @param gradeTable 选手成绩录入
     * @return 结果
     */
    @Override
    public int updateGradeTable(GradeTable gradeTable)
    {
        gradeTable.setUpdateTime(DateUtils.getNowDate());
        return gradeTableMapper.updateGradeTable(gradeTable);
    }

    /**
     * 批量删除选手成绩录入
     *
     * @param ids 需要删除的选手成绩录入主键
     * @return 结果
     */
    @Override
    public int deleteGradeTableByIds(Long[] ids)
    {
        return gradeTableMapper.deleteGradeTableByIds(ids);
    }

    /**
     * 删除选手成绩录入信息
     *
     * @param id 选手成绩录入主键
     * @return 结果
     */
    @Override
    public int deleteGradeTableById(Long id)
    {
        return gradeTableMapper.deleteGradeTableById(id);
    }
}
